import { http } from "@/plugin/http";

// 地址列表
export const getAddressList = async () => {
  try {
    return await http.post<API.Deliver.AddressListResponse>(
      "/deliver/address/list"
    );
  } catch (error) {
    return null;
  }
};

// 新增地址
export const plusAddress = async (params: API.Deliver.AddressItem) => {
  try {
    await http.post("/deliver/address/create", params);
    return true;
  } catch (error) {
    return false;
  }
};

// 新增地址
export const deleteAddress = async (
  params: API.Deliver.DeleteAddressParams
) => {
  try {
    await http.post("/deliver/address/delete", params);
    return true;
  } catch (error) {
    return false;
  }
};

// 发货商品
export const deliverProduct = async (
  params: API.Deliver.DeliverProductParams
) => {
  try {
    await http.post("/deliver/deliver-product", params);
    return true;
  } catch (error) {
    return false;
  }
};
